Micron Document
<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>Local binary patterns</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/Local_binary_patterns"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Local_binary_patterns rootpage-Local_binary_patterns skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">Local binary patterns</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr">
<p><b>Local binary patterns</b> (<b>LBP</b>) is a type of <a href="Visual_descriptor" title="Visual descriptor">visual descriptor</a> used for classification in <a href="Computer_vision" title="Computer vision">computer vision</a>. LBP is the particular case of the Texture Spectrum model proposed in 1990.<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup> LBP was first described in 1994.<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup> It has since been found to be a powerful feature for texture classification; it has further been determined that when LBP is combined with the <a href="Histogram_of_oriented_gradients" title="Histogram of oriented gradients">Histogram of oriented gradients</a> (HOG) descriptor, it improves the detection performance considerably on some datasets.<sup id="cite_ref-5" class="reference"><a href="#cite_note-5"><span class="cite-bracket">[</span>5<span class="cite-bracket">]</span></a></sup> A comparison of several improvements of the original LBP in the field of background subtraction was made in 2015 by Silva et al.<sup id="cite_ref-6" class="reference"><a href="#cite_note-6"><span class="cite-bracket">[</span>6<span class="cite-bracket">]</span></a></sup> A full survey of the different versions of LBP can be found in Bouwmans et al.<sup id="cite_ref-7" class="reference"><a href="#cite_note-7"><span class="cite-bracket">[</span>7<span class="cite-bracket">]</span></a></sup>
</p>
<meta property="mw:PageProp/toc">
<div class="mw-heading mw-heading2"><h2 id="Concept">Concept</h2></div>

<p>The LBP feature vector, in its simplest form, is created in the following manner:
</p>
<ul><li>Divide the examined window into cells (e.g. 16x16 pixels for each cell).</li>
<li>For each pixel in a cell, compare the pixel to each of its <a href="Pixel_connectivity" title="Pixel connectivity">8 neighbors</a> (on its left-top, left-middle, left-bottom, right-top, etc.). Follow the pixels along a circle, i.e. clockwise or counter-clockwise.</li>
<li>Where the center pixel's value is greater than the neighbor's value, write "0". Otherwise, write "1". This gives an 8-digit binary number (which is usually converted to decimal for convenience).</li>
<li>Compute the <a href="Histogram" title="Histogram">histogram</a>, over the cell, of the frequency of each "number" occurring (i.e., each combination of which pixels are smaller and which are greater than the center). This histogram can be seen as a 256-dimensional <a href="Feature_vector" class="mw-redirect" title="Feature vector">feature vector</a>.</li>
<li>Optionally normalize the histogram.</li>
<li>Concatenate (normalized) histograms of all cells. This gives a feature vector for the entire window.</li></ul>
<p>The feature vector can now be processed using the <a href="Support_vector_machine" title="Support vector machine">Support vector machine</a>, <a href="Extreme_learning_machine" title="Extreme learning machine">extreme learning machines</a>, or some other <a href="Machine_learning" title="Machine learning">machine learning</a> algorithm to classify images. Such classifiers can be used for <a href="Facial_recognition_system" title="Facial recognition system">face recognition</a> or texture analysis.
</p><p>A useful extension to the original operator is the so-called uniform pattern,<sup id="cite_ref-8" class="reference"><a href="#cite_note-8"><span class="cite-bracket">[</span>8<span class="cite-bracket">]</span></a></sup> which can be used to reduce the length of the feature vector and implement a simple rotation invariant descriptor. This idea is motivated by the fact that some binary patterns occur more commonly in texture images than others. A local binary pattern is called uniform if the binary pattern contains at most two 0-1 or 1-0 transitions. For example, 00010000 (2 transitions) is a uniform pattern, but 01010100 (6 transitions) is not. In the computation of the LBP histogram, the histogram has a separate bin for every uniform pattern, and all non-uniform patterns are assigned to a single bin. Using uniform patterns, the length of the feature vector for a single cell reduces from 256 to 59. The 58 uniform binary patterns correspond to the integers 0, 1, 2, 3, 4, 6, 7, 8, 12, 14, 15, 16, 24, 28, 30, 31, 32, 48, 56, 60, 62, 63, 64, 96, 112, 120, 124, 126, 127, 128, 129, 131, 135, 143, 159, 191, 192, 193, 195, 199, 207, 223, 224, 225, 227, 231, 239, 240, 241, 243, 247, 248, 249, 251, 252, 253, 254 and 255.
</p>
<div class="mw-heading mw-heading2"><h2 id="Extensions">Extensions</h2></div>
<ul><li>Over-Complete Local Binary Patterns (OCLBP):<sup id="cite_ref-9" class="reference"><a href="#cite_note-9"><span class="cite-bracket">[</span>9<span class="cite-bracket">]</span></a></sup> OCLBP is a variant of LBP that has been shown to improve the overall performance on face verification. Unlike LBP, OCLBP adopts overlapping to adjacent blocks. Formally, the configuration of OCLBP is denoted as S&nbsp;: (a, b, v, h, p, r): an image is divided into a×b blocks with vertical overlap of v and horizontal overlap of h, and then uniform patterns LBP(u2,p,r) are extracted from all the blocks. Moreover, OCLBP is composed of several different configurations. For example, in their original paper, the authors used three configurations: S&nbsp;: (10,10,12,12,8,1),(14,14,12,12,8,2),(18,18,12,12,8,3). The three configurations consider three block sizes: 10×10, 14×14, 18×18, and half overlap rates along the vertical and horizontal directions. These configurations are concatenated to form a 40877 dimensional feature vector for an image of size 150x80.</li>
<li>Transition Local Binary Patterns(tLBP):<sup id="cite_ref-10" class="reference"><a href="#cite_note-10"><span class="cite-bracket">[</span>10<span class="cite-bracket">]</span></a></sup> binary value of transition coded LBP is composed of neighbor pixel comparisons clockwise direction for all pixels except the central.</li>
<li>Direction coded Local Binary Patterns(dLBP): the dLBP encodes the intensity variation along the four basic directions through the central pixel in two bits.</li>
<li>Multi-block LBP: the image is divided into many blocks, a LBP histogram is calculated for every block and concatenated as the final histogram.</li>
<li>Volume Local Binary Pattern(VLBP):<sup id="cite_ref-11" class="reference"><a href="#cite_note-11"><span class="cite-bracket">[</span>11<span class="cite-bracket">]</span></a></sup> VLBP looks at dynamic texture as a set of volumes in the (X,Y,T) space where X and Y denote the spatial coordinates and T denotes the frame index. The neighborhood of a pixel is thus defined in three dimensional space, and volume textons can be extracted into histograms.</li>
<li>RGB-LBP: This operator is obtained by computing LBP over all three channels of the RGB color space independently, and then concatenating the results together.</li></ul>
<div class="mw-heading mw-heading2"><h2 id="Implementations">Implementations</h2></div>
<ul><li><a rel="nofollow" class="external text" href="http://www.cse.oulu.fi/CMV">CMV</a>, includes the general LBP <a rel="nofollow" class="external text" href="http://www.cse.oulu.fi/CMV/Downloads/LBPMatlab">implementation</a> <a rel="nofollow" class="external text" href="https://web.archive.org/web/20141128164522/http://www.cse.oulu.fi/CMV/Downloads/LBPMatlab?">Archived</a> 2014-11-28 at the <a href="Wayback_Machine" title="Wayback Machine">Wayback Machine</a> and many further extensions over LBP histogram in MATLAB.</li>
<li><a rel="nofollow" class="external text" href="http://luispedro.org/software/mahotas">Python mahotas</a>, an open source computer vision package which includes an implementation of LBPs.</li>
<li> <a href="OpenCV" title="OpenCV">OpenCV</a>'s Cascade Classifiers support LBPs as of version 2.</li>
<li><a rel="nofollow" class="external text" href="http://vlfeat.org/">VLFeat</a>, an open source computer vision library in C (with bindings to multiple languages including MATLAB) has an <a rel="nofollow" class="external text" href="http://www.vlfeat.org/api/lbp_8h.html">implementation</a>.</li>
<li><a rel="nofollow" class="external text" href="https://github.com/carolinepacheco/lbplibrary">LBPLibrary</a> is a collection of eleven Local Binary Patterns (LBP) algorithms developed for background subtraction problem. The algorithms were implemented in C++ based on OpenCV. A CMake file is provided and the library is compatible with Windows, Linux and Mac OS X. The library was tested successfully with OpenCV 2.4.10.</li>
<li><a rel="nofollow" class="external text" href="https://code.google.com/p/bgslibrary/">BGSLibrary</a> includes the original LBP implementation for motion detection<sup id="cite_ref-12" class="reference"><a href="#cite_note-12"><span class="cite-bracket">[</span>12<span class="cite-bracket">]</span></a></sup> as well as a new LBP operator variant combined with Markov Random Fields<sup id="cite_ref-13" class="reference"><a href="#cite_note-13"><span class="cite-bracket">[</span>13<span class="cite-bracket">]</span></a></sup> with improved recognition rates and robustness.</li>
<li><a rel="nofollow" class="external text" href="http://dlib.net">dlib</a>, an open source C++ library: <a rel="nofollow" class="external text" href="https://github.com/davisking/dlib/blob/master/dlib/image_transforms/lbp.h">implementation</a>.</li>
<li><a rel="nofollow" class="external text" href="http://scikit-image.org/">scikit-image</a>, an open source Python library. Provides a c-based python <a rel="nofollow" class="external text" href="https://github.com/scikit-image/scikit-image/blob/master/skimage/feature/_texture.pyx#L95">implementation</a> for LBP</li></ul>
<div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div>
<ul><li><a href="Local_ternary_patterns" title="Local ternary patterns">Local ternary patterns</a></li>
<li><a rel="nofollow" class="external text" href="http://www.scholarpedia.org/article/Local_Binary_Patterns">Local Binary Pattern (LBP) methodology in Scholarpedia</a></li>
<li><a href="Census_transform" title="Census transform">Census transform</a></li></ul>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */


.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}


/* end https://en.wikipedia.org/ */
</style><div class="reflist">
<div class="mw-references-wrap mw-references-columns"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-1">^</a></b></span> <span class="reference-text">DC. He and L. Wang (1990), "Texture Unit, Texture Spectrum, And Texture Analysis", Geoscience and Remote Sensing, IEEE Transactions on, vol. 28, pp. 509 - 512.</span>
</li>
<li id="cite_note-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-2">^</a></b></span> <span class="reference-text">L. Wang and DC. He (1990), "Texture Classification Using Texture Spectrum", Pattern Recognition, Vol. 23, No. 8, pp. 905 - 910.</span>
</li>
<li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text">T. Ojala, <a href="Matti_Pietik%C3%A4inen_(academic)" title="Matti Pietikäinen (academic)">M. Pietikäinen</a>, and D. Harwood (1994), "Performance evaluation of texture measures with classification based on Kullback discrimination of distributions", Proceedings of the 12th IAPR International Conference on Pattern Recognition (ICPR 1994), vol. 1, pp. 582 - 585.</span>
</li>
<li id="cite_note-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-4">^</a></b></span> <span class="reference-text">T. Ojala, M. Pietikäinen, and D. Harwood (1996), "A Comparative Study of Texture Measures with Classification Based on Feature Distributions", Pattern Recognition, vol. 29, pp. 51-59.</span>
</li>
<li id="cite_note-5"><span class="mw-cite-backlink"><b><a href="#cite_ref-5">^</a></b></span> <span class="reference-text">"An HOG-LBP Human Detector with Partial Occlusion Handling", Xiaoyu Wang, Tony X. Han, Shuicheng Yan, ICCV 2009</span>
</li>
<li id="cite_note-6"><span class="mw-cite-backlink"><b><a href="#cite_ref-6">^</a></b></span> <span class="reference-text">C. Silva, T. Bouwmans, C. Frelicot, "An eXtended Center-Symmetric Local Binary Pattern for Background Modeling and Subtraction in Videos", VISAPP 2015, Berlin, Germany, March 2015.</span>
</li>
<li id="cite_note-7"><span class="mw-cite-backlink"><b><a href="#cite_ref-7">^</a></b></span> <span class="reference-text">T. Bouwmans, C. Silva, C. Marghes, M. Zitouni, H. Bhaskar, C. Frelicot,, "On the Role and the Importance of Features for Background Modeling and Foreground Detection”, <style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */


.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}


/* end https://en.wikipedia.org/ */
</style><a href="ArXiv_(identifier)" class="mw-redirect" title="ArXiv (identifier)">arXiv</a>:<span class="id-lock-free" title="Freely accessible"><a rel="nofollow" class="external text" href="https://arxiv.org/abs/1611.09099">1611.09099</a></span></span>
</li>
<li id="cite_note-8"><span class="mw-cite-backlink"><b><a href="#cite_ref-8">^</a></b></span> <span class="reference-text">Barkan et al. "Fast High Dimensional Vector Multiplication Face Recognition." Proceedings of ICCV 2013</span>
</li>
<li id="cite_note-9"><span class="mw-cite-backlink"><b><a href="#cite_ref-9">^</a></b></span> <span class="reference-text">Barkan et al. "Fast High Dimensional Vector Multiplication Face Recognition." Proceedings of ICCV 2013</span>
</li>
<li id="cite_note-10"><span class="mw-cite-backlink"><b><a href="#cite_ref-10">^</a></b></span> <span class="reference-text">Trefný, Jirí, and Jirí Matas."Extended set of local binary patterns for rapid object detection." Proceedings of the Computer Vision Winter Workshop. Vol. 2010. 2010.</span>
</li>
<li id="cite_note-11"><span class="mw-cite-backlink"><b><a href="#cite_ref-11">^</a></b></span> <span class="reference-text">Zhao, Guoying, and Matti Pietikainen. "Dynamic texture recognition using local binary patterns with an application to facial expressions." IEEE Transactions on Pattern Analysis and Machine Intelligence 29.6 (2007): 915-928.</span>
</li>
<li id="cite_note-12"><span class="mw-cite-backlink"><b><a href="#cite_ref-12">^</a></b></span> <span class="reference-text">M. Heikkilä, M. Pietikäinen, "A texture-based method for modeling the background and detecting moving objects", IEEE Transactions on Pattern Analysis and Machine Intelligence, 28(4):657-662, 2006.</span>
</li>
<li id="cite_note-13"><span class="mw-cite-backlink"><b><a href="#cite_ref-13">^</a></b></span> <span class="reference-text">C., Kertész: Texture-Based Foreground Detection, International Journal of Signal Processing, Image Processing and Pattern Recognition (IJSIP), Vol. 4, No. 4, 2011.</span>
</li>
</ol></div></div></div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2024-11-15" href="https://en.wikipedia.org/wiki/?title=Local_binary_patterns&amp;oldid=1257468248">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>

</body></html>